import React, { useContext, useState } from 'react';
import myContext from "../../../../utils/myContext"

export default function SonA() {
  const [age,setAge] = useState(12);
  const value = useContext(myContext);

  return (
    <>
      <div>SonA</div>
      <p>value.name:{value.name}</p>
      <hr/>
      <hr/>
      <hr/>
      <hr/>
      <hr/>
      <p>value.age:{value.age}</p>
      <hr/>
      <input type="button" value="修改年龄" onClick={()=>value.changeAge(3)} />

    </>
  )
}

